<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<script src="./vue.js" type="text/javascript" charset="utf-8"></script>
		<title>index_0222_01</title>
	</head>
	<body>
		<div id="app1">
			{{message}} {{name}}
		</div>
		<script type="text/javascript">
			var data = {message: 'gss', name:'123'}
			var app = new Vue({
				el: '#app1',
				data: data
			})
			
			data.name = 'abc'
			
			// 第一个参数：监听的变量名称，第二参数是回调函数
			app.$watch('name',function(newVal, oldVal){
				console.log('姓名从' + oldVal + '变成' + newVal)
			})
			
			// if(data.name === 'abc') {
			// 	data.name = 'qiyang'
			// }
			
			setTimeout(function(){
				data.name = '高赛'
			}, 1000)
			
			// var it = setInterval(function(){
			// 	console.info('我又变化了')
			// }, 1000)
			
			// clearInterval(it)
			
		</script>
	</body>
</html>
